package com.example.game.module.mapper;


import com.example.game.module.entity.Game;
import org.apache.ibatis.annotations.*;

import java.math.BigInteger;
import java.util.List;

@Mapper
public interface GameMapper {

    List<Game> findAll(@Param("offset") int offset, @Param("pagesize") int pagesize,@Param("gameName")String gameName);

    @Select("SELECT COUNT(*) FROM game WHERE is_deleted = 0")
    Integer getTotalRecode();

    @Select("SELECT * FROM game WHERE id = #{gameId} and is_deleted = 0")
    Game getById(BigInteger gameId);

    @Select("SELECT * FROM game WHERE id = #{gameId} ")
    Game extractById(BigInteger gameId);

    int insert(Game game);

    int update(Game game);

    @Update("UPDATE game SET is_deleted = 1,update_time = #{updateTime} WHERE id = #{gameId}")
    int delete(@Param("gameId") BigInteger gameId, @Param("updateTime") Integer updateTime);
}
